package com.example.demo.innoket.generator;

import com.example.demo.innoket.factory.CodeGenerateFactory;
import com.example.demo.innoket.util.GeneratorConfig;
import com.example.demo.innoket.util.Resources;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by zhangLi on 2016/6/20.
 * 1、在config/config.properties配置数据库路径和作者；
 * 2、CodeGenerateFactory.init("SYS_SYSTEM_MANAGE", GeneratorConfig.ModulePath.LILY_WHITES_SYS);
 *      用来配置生成的表名和项目名
 * 3、dir路径为目前项目文件路径，若 “System.getProperty("user.dir")” 获取路径有误，
 *      可自行配置“Resources.BASE_PACKAGE”的值，类似于：D：/workspace/Fragrans
 */
public class GeneratorHelper {

	public static void main(String[] args) throws InterruptedException {
		List<String> list = new ArrayList<String>();

		//TODO ---------------------------1.此处需要添加要生成的表名-------------------------------

		list.add("life_car_bus_info"); //需要生成代码的表名
//		list.add("life_car_bus_info_1"); //需要生成代码的表名1
//		list.add("life_car_bus_info_2"); //需要生成代码的表名2

		String dir = System.getProperty("user.dir");
		System.out.println("your workspace adddress = [" + dir + "]");


		for (int i = 0; i < list.size(); i++) {

			CodeGenerateFactory.init(list.get(i), GeneratorConfig.ModulePath.PHP_COMMON_BASE);

			CodeGenerateFactory.createEntity();//初始化实体类
			CodeGenerateFactory.createRequest ();//初始化Requests
			CodeGenerateFactory.createControllerAdmin();//初始化controller.admin
			CodeGenerateFactory.createControllerInner();//初始化controller.inner
			CodeGenerateFactory.createControllerMember();//初始化controller.member
			CodeGenerateFactory.createService();//初始化service
			CodeGenerateFactory.createRoute();//初始化路由route

			/* 初始化扩展类 Exports,join查询 导出 */

		}
	}
}
